<?php
	/*
		PandaForum: PHP Forum Engine
		
		Jesse Gill, 0108377707
	*/
	
	require_once('./src/classes/Page.php');
	
	$page = new Page('Viewforum');
	
	$page->print_header();
	
	$id =					$page->connection->clean_var($_GET['id']);
	$pagenum = 				$page->connection->clean_var($_GET['page']);
	
	$forum = $page->connection->get_result_array("SELECT * FROM forum WHERE id=$id");
	
	if (empty($forum))
		die("Invalid forum id.");
?>
	<link href='src/css/viewforum.css' rel='stylesheet' type='text/css' />
	<script type="text/javascript" src="src/js/ajax_functions_viewforum.js"></script>
	
	<script type="text/javascript">
		viewforum_topics_refreshlist(<?php echo $id; ?>, <?php echo $pagenum; ?>);
	</script>
	
	<h1 class="pageheading">Viewforum - <?php echo $forum['name']; ?></h1>
	
	<div id="topics">
		
	</div>
	
	<form id="addtopic" name="addTopic" method="post" action="javascript:ajax_addtopic(document.addTopic.name.value, document.addTopic.post.value, <?php echo $forum['id'] ?>)">
		<h3>Add Topic</h3><br />
		Name: <input type="text" name="name" /><br /><br />
		Post: <textarea name='post' rows="10" cols="30"></textarea><br /><br />
		<input type="submit" value="Add Topic" /><br /><br />
		<div id="result"> </div>
	</form>
<?php
	$page->print_footer();
?>